% a short introduction of matlab

%% 2D plots

x=-4:0.1:4;
y=sin(x);
% 2d plot fig without maker and linestyle
plot(x,y);

% set plot options
% set x-axis legend
xlabel('x')
% set y-axis legend
ylabel('y=sin(x)')
% set axis limit range
axis([-4 4 -1.2 1.2 ])
% ? Automatic limits
% axis auto
% ? Same scale for both axis
% axis square
% ? Same scale for both axis
% axis equal
% ? Scales again
% axis on
% ? Removes scale
% axis off

figure 
% 2d plot fig with maker and linestyle
x1 = 0:0.01:2*pi;
y1 = sin(x1);
y2 = sin(2*x1);
y3 = sin(4*x1);

plot(x1,y1,'--',x1,y2,':',x1,y3,'+');

%% 3D plots

t=.01:.01:20*pi;
x=cos(t);
y=sin(t);
z=t.^3;

plot3(x,y,z)

%% Linear algebra

a=rand(3);
b=rand(3,1);
x=a\b;

disp(x)





